package com.jingdong.callback.model;

/**
 * 连通性测试结果
 * 
 * @author SDK Team
 */
public class ConnectivityResult {
    
    /**
     * DNS解析结果
     */
    private DnsResult dns;
    
    /**
     * 端口连通性结果
     */
    private PortResult port;
    
    /**
     * HTTP请求结果
     */
    private HttpResult http;
    
    // Getters and Setters
    
    public DnsResult getDns() {
        return dns;
    }
    
    public void setDns(DnsResult dns) {
        this.dns = dns;
    }
    
    public PortResult getPort() {
        return port;
    }
    
    public void setPort(PortResult port) {
        this.port = port;
    }
    
    public HttpResult getHttp() {
        return http;
    }
    
    public void setHttp(HttpResult http) {
        this.http = http;
    }
    
    @Override
    public String toString() {
        return "ConnectivityResult{" +
                "dns=" + dns +
                ", port=" + port +
                ", http=" + http +
                '}';
    }
    
    /**
     * DNS解析结果
     */
    public static class DnsResult {
        private String host;
        private String ip;
        private boolean success;
        
        public DnsResult(String host, String ip, boolean success) {
            this.host = host;
            this.ip = ip;
            this.success = success;
        }
        
        public String getHost() {
            return host;
        }
        
        public void setHost(String host) {
            this.host = host;
        }
        
        public String getIp() {
            return ip;
        }
        
        public void setIp(String ip) {
            this.ip = ip;
        }
        
        public boolean isSuccess() {
            return success;
        }
        
        public void setSuccess(boolean success) {
            this.success = success;
        }
        
        @Override
        public String toString() {
            return "DnsResult{" +
                    "host='" + host + '\'' +
                    ", ip='" + ip + '\'' +
                    ", success=" + success +
                    '}';
        }
    }
    
    /**
     * 端口连通性结果
     */
    public static class PortResult {
        private String host;
        private int port;
        private boolean success;
        private String error;
        
        public PortResult(String host, int port, boolean success, String error) {
            this.host = host;
            this.port = port;
            this.success = success;
            this.error = error;
        }
        
        public String getHost() {
            return host;
        }
        
        public void setHost(String host) {
            this.host = host;
        }
        
        public int getPort() {
            return port;
        }
        
        public void setPort(int port) {
            this.port = port;
        }
        
        public boolean isSuccess() {
            return success;
        }
        
        public void setSuccess(boolean success) {
            this.success = success;
        }
        
        public String getError() {
            return error;
        }
        
        public void setError(String error) {
            this.error = error;
        }
        
        @Override
        public String toString() {
            return "PortResult{" +
                    "host='" + host + '\'' +
                    ", port=" + port +
                    ", success=" + success +
                    ", error='" + error + '\'' +
                    '}';
        }
    }
    
    /**
     * HTTP请求结果
     */
    public static class HttpResult {
        private boolean success;
        private int httpCode;
        private String error;
        
        public HttpResult(boolean success, int httpCode, String error) {
            this.success = success;
            this.httpCode = httpCode;
            this.error = error;
        }
        
        public boolean isSuccess() {
            return success;
        }
        
        public void setSuccess(boolean success) {
            this.success = success;
        }
        
        public int getHttpCode() {
            return httpCode;
        }
        
        public void setHttpCode(int httpCode) {
            this.httpCode = httpCode;
        }
        
        public String getError() {
            return error;
        }
        
        public void setError(String error) {
            this.error = error;
        }
        
        @Override
        public String toString() {
            return "HttpResult{" +
                    "success=" + success +
                    ", httpCode=" + httpCode +
                    ", error='" + error + '\'' +
                    '}';
        }
    }
}
